package remato.domain.common.impl;

import java.util.HashSet;
import java.util.Set;

import remato.common.domain.helpers.Nameable;
import remato.common.domain.impl.base.DomainName;
import remato.domain.common.Requirement;
import remato.domain.common.Stakeholder;

/**
 * @version $Id: StakeholderImpl.java,v 1.1 2006-01-23 09:27:22 petterei Exp $
 */
public class StakeholderImpl extends DomainName implements Stakeholder, Nameable {
	private String firstName;
	private String lastName;
	private Set<Requirement> stakeholderToRequirements;
	private Set<Requirement> reporterOrOwnerToRequirements;
	private Set<Requirement> assignedRequirements;
	
	public StakeholderImpl() {
		super();
		stakeholderToRequirements = new HashSet<Requirement>();
		reporterOrOwnerToRequirements = new HashSet<Requirement>();
		assignedRequirements = new HashSet<Requirement>();
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public Set<Requirement> getReporterOrOwnerToRequirements() {
		return reporterOrOwnerToRequirements;
	}
	
	public void setReporterOrOwnerToRequirements(Set<Requirement> requirements) {
		this.reporterOrOwnerToRequirements = requirements;
	}
	
	/*
	 * This a one way link, thus it is not revealed in the interface
	 */
	public boolean addReporterOrOwnerToRequirement(Requirement requirement){
		return reporterOrOwnerToRequirements.add(requirement);
	}

	/*
	 * This a one way link, thus it is not revealed in the interface
	 */
	public boolean removeReporterOrOwnerToRequirement(Requirement requirement) {
		return this.reporterOrOwnerToRequirements.remove(requirement);
	}

	public Set<Requirement> getAssignedRequirements() {
		return assignedRequirements;
	}
	
	/*
	 * This a one way link, thus it is not revealed in the interface
	 */
	public void setAssignedRequirements(Set<Requirement> requirements) {
		this.assignedRequirements = requirements;
	}
	
	/*
	 * This a one way link, thus it is not revealed in the interface
	 */
	public boolean addAssignedRequirement(Requirement requirement){
		return assignedRequirements.add(requirement);
	}

	/*
	 * This a one way link, thus it is not revealed in the interface
	 */
	public boolean removeAssignedRequirement(Requirement requirement) {
		return this.assignedRequirements.remove(requirement);
	}

	public Set<Requirement> getStakeholderToRequirements() {
		return stakeholderToRequirements;
	}

	public void setStakeholderToRequirements(
			Set<Requirement> stakeholderToRequirements) {
		this.stakeholderToRequirements = stakeholderToRequirements;
	}

	/*
	 * This a one way link, thus it is not revealed in the interface
	 */
	public boolean addStakeholderToRequirement(Requirement requirement){
		return stakeholderToRequirements.add(requirement);
	}
	
	/*
	 * This a one way link, thus it is not revealed in the interface
	 */
	public boolean removeStakeholderToRequirement(Requirement requirement) {
		return this.stakeholderToRequirements.remove(requirement);
	}

	@Override
	public String getName() {
		return getFirstName() + " " + getLastName();
	}

	/**
	 * @deprecated use setFirstName and setLastName
	 */
	@Deprecated
	@Override
	public void setName(@SuppressWarnings("unused") String name) {
		// should use setFirstname() and setLastName()
	}
	
}
